package com.changqin;

import java.util.concurrent.CyclicBarrier;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class CyclicBarrierTest {

  public static void main(String[] args) {
    CyclicBarrier cyclicBarrier = new CyclicBarrier(3,()->{
      System.out.println("success  -----");
    });

    ExecutorService service = Executors.newFixedThreadPool(3);
    service.execute(new PlayerTool("111",cyclicBarrier));
    service.execute(new PlayerTool("222",cyclicBarrier));
    service.execute(new PlayerTool("333",cyclicBarrier));

      //Thread player1= new Thread(new PlayerTool("111",cyclicBarrier));
      //Thread player2= new Thread(new PlayerTool("222",cyclicBarrier));
      //Thread player3= new Thread(new PlayerTool("333",cyclicBarrier));

//    player1.start();
//    player2.start();
//    player3.start();


  }
}
